home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / New System Software Extensions / QuickDraw™ GX v1.0ß2 / Sample Code / Printing Samples / Extensions… / Additions Source / Additions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-31  |  5.2 KB  |  138 lines  |  [TEXT/MPS ]

  1. /* ------------------------------------------------------------------------------
  2.  
  3.     FILENAME
  4.         Additions.h
  5.  
  6.     DESCRIPTION
  7.         This header file contains the declarations of the routines that create the graphical effects 
  8.         of the Additions printing extension.  These routines allow the user to augment pages of a document with additive effects.
  9.         These effects include:
  10.         
  11.                     Adding a page border
  12.                     Serialize all printed copies
  13.                     Add cover page at beginning or end.
  14.                     
  15.         These options are configured through a Print dialog panel.
  16.  
  17.     COPYRIGHT
  18.         Copyright Apple Computer, Inc. 1991
  19.         All rights reserved. 
  20.     
  21.     INTERFACE ROUTINES
  22.         ComposeCoverPage
  23.         AddPageBorder
  24.         CreateNumberShape
  25.         SerializeCopies
  26.  
  27.     MODIFICATION HISTORY
  28.         05/15/91            ALA                Initial Implementation
  29.  
  30.  
  31. ------------------------------------------------------------------------------- */
  32.  
  33. /*==================================== GLOBALS ====================================*/
  34.  
  35.  
  36. extern gxShape gSerialShape;
  37.  
  38.  
  39. /*==================================== CONSTANTS ====================================*/
  40.  
  41.  
  42. /* ===== Constants for accessing the 'addi' collection item. ===== */
  43.  
  44. #define    kAdditionsCollectionType    'addi'    /* Item type of the 'addi' Filter collection */
  45.  
  46.  
  47. /* ===== Constants for Identifying Cover Page First and Last ===== */
  48.  
  49. #define    kCoverPageFirst                0            /*    Add cover page at beginning of document */
  50. #define    kCoverPageLast                    1            /*    Add cover page at end of document */
  51.  
  52.  
  53. /*==================================== TYPES ====================================*/
  54.  
  55.  
  56. /* AdditionsCollection - structure defining the format of the 'addi' collection item.  It defines the */
  57. /*                                  type of additions to add to document pages.  The Addition's Print time dialog panel */
  58. /*                                 is used to set the values in this structure. This structure must match */
  59. /*                                 the 'xdtl'resource in the Additions.r file. */
  60.  
  61. typedef struct
  62. {
  63.     long            nextEndSerialNum;        //    ending serial number in the next batch to print
  64.     char            coverPage;                //    kCoverPageFirst or kCoverPageLast depending upon radio button settings
  65.     Boolean        addPageBorder;            //    true => add page border to document pages
  66.     Boolean        serializeCopies;        //    true => serialize all document pages
  67.     Boolean        addCoverPage;            //    true => add cover page to the document
  68. }    AdditionsCollection, *AdditionsCollectionPtr, **AdditionsCollectionHdl;
  69.  
  70.  
  71. /*======================== INTERFACE ROUTINES =======================*/
  72.  
  73.  
  74. /*========================= INTERFACE ROUTINES FOR ADDING A COVER PAGE =========================*/
  75.  
  76.  
  77. /* ===== ComposeCoverPage =====
  78.  
  79.     ComposeCoverPage creates a picture which represents the cover page of the printed
  80.     document.
  81. */
  82. OSErr ComposeCoverPage(                        //    (out)    Error code
  83.     gxShape                        *coverPage,        //    (out)    picture representing the cover page
  84.     gxFormat                        theFormat,        //    (in)    Cover page format reference
  85.     gxJobInfo                    *printerInfo);    //    (in)    Contains info. about the document being printed
  86.  
  87.  
  88. /*=================== INTERFACE ROUTINES FOR ADDING PAGE BORDER TO DOCUMENT PAGES ===================*/
  89.  
  90.  
  91. /* ===== AddPageBorder =====
  92.  
  93.     AddPageBorder adds a border around the entire page and and scales the page to make sure
  94.     all shapes fit within the border.  The page to border is specified by the "page" parameter.
  95.     
  96.     To add the page border, the routine performs the following steps:
  97.         1.    Make a copy of the original page shape (newPage variable).
  98.         2.    Scale the newPage shape by approx. 80%.
  99.         3.    Scale any embedded bitmaps in the newPage shape. (graphics didn't handle this before).
  100.         4.    Remove all shapes from the original page shape (page variable).
  101.         5.    Add the newPage shape to the page shape (must preserve the original page referenced passed to us).
  102.         6.    Add the shapes to the page shape which comprise the border.
  103.     
  104.     Note: the original page shape is duplicated because we must scale the contents of the shape,
  105.     but not the shapes which comprise the border.  Previously, it didn't work to scale the page down
  106.     and scale the border up so it's bigger.
  107. */
  108. OSErr AddPageBorder(                //    (out)    Error code
  109.     gxShape        page,                //    (in)    picture for the page being spooled; we'll add a border to it
  110.     gxFormat        pageFormat,        //    (in)    Page format record
  111.     Str32            docName);        //    (in)    Name of the document being printed
  112.  
  113.  
  114. /*======================== INTERFACE ROUTINES FOR SERIALIZING DOCUMENT PAGES =======================*/
  115.  
  116.  
  117. /* ===== CreateNumberShape =====
  118.  
  119.     CreateNumberShape creates a text shape which will be used to contain the serial number to
  120.     be added to the pages of the document.  This shape will exist for as long as the page
  121.     exists.  It's temporarily stored in the extension's refCon so we can retrieve it at render 
  122.     page time.
  123. */
  124. OSErr CreateNumberShape(void);    //    (out)    error code
  125.  
  126.  
  127. /* ===== SerializeCopies =====
  128.  
  129.     SerializeCopies adds the copy # to each page which is printed.
  130. */
  131. void SerializeCopies(                    //    (out)    Error code
  132.     gxShape            page,                    //    (in)    picture for the page being spooled
  133.     gxFormat            pageFormat,            //    (in)    Page format record
  134.     long                currCopyNum,        //    (in)    Current copy of the document being printed (relative to beginning of the job)
  135.     Boolean            *pageChanged,        //    (out)    True if a copy of a page has changed; otherwise ignored
  136.     long                 nextEndSerialNum,    //    (in)    last serial number in the batch being printed
  137.     long                 numCopies);            //    (in)    number of copies being printed
  138.